package com.ziyun.erp.modules.productBaseInfo.service.impl;

import com.ziyun.erp.modules.goods.dto.OptionDto;
import com.ziyun.erp.modules.productBaseInfo.dao.ProductBaseInfoDao;
import com.ziyun.erp.modules.productBaseInfo.entity.ProductBaseInfoEntity;
import com.ziyun.erp.modules.productBaseInfo.service.ProductBaseInfoService;
import com.ziyun.erp.modules.quoteAttribute.entity.QuoteAttributeOptionEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;



@Service("productBaseInfoService")
public class ProductBaseInfoServiceImpl extends ServiceImpl<ProductBaseInfoDao, ProductBaseInfoEntity> implements ProductBaseInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<ProductBaseInfoEntity> page = this.selectPage(
                new Query<ProductBaseInfoEntity>(params).getPage(),
                new EntityWrapper<ProductBaseInfoEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public List<OptionDto> selectEditSelectOptionIds(Long goodsId, Integer attributeId, Integer partId) {
        return this.baseMapper.selectEditSelectOptionIds(goodsId,attributeId,partId);
    }

    @Override
    public List<OptionDto> selectEditSelectOptionIdsTwo(Long goodsId, Integer attributeId) {
        return this.baseMapper.selectEditSelectOptionIdsTwo(goodsId,attributeId);
    }

    @Override
    public List<Map<String,Object>> selectEditHasPriceMaterialOption(Long goodsId, Integer partId, int i, String optionKey) {
        return this.baseMapper.selectEditHasPriceMaterialOption(goodsId,partId,i,optionKey);
    }

    @Override
    public List<Map<String,Object>> selectEditHasPriceMaterialOptionTwo(Long goodsId, int i, String optionKey) {
        return this.baseMapper.selectEditHasPriceMaterialOptionTwo(goodsId,i,optionKey);
    }

    @Override
    public void delFlagQuoteProductByGoodsId(Long goodsId) {
        this.baseMapper.delFlagQuoteProductByGoodsId(goodsId);
    }

    @Override
    public Integer getEditSelectDefaultOptionId(Long goodsId, Integer attributeId, Integer partId) {
        return this.baseMapper.getEditSelectDefaultOptionId(goodsId,attributeId,partId);
    }

    @Override
    public Integer getEditSelectDefaultOptionIdTwo(Long goodsId, Integer attributeId) {
        return this.baseMapper.getEditSelectDefaultOptionIdTwo(goodsId,attributeId);
    }

    @Override
    public ProductBaseInfoEntity getEditSelectDefaultMaterialOption(Long goodsId) {
        return this.baseMapper.getEditSelectDefaultMaterialOption(goodsId);
    }

    @Override
    public ProductBaseInfoEntity getEditSelectDefaultMaterialOptionTwo(Long goodsId, Integer partId) {
        return this.baseMapper.getEditSelectDefaultMaterialOptionTwo(goodsId,partId);
    }

    @Override
    public void deleteProductBaseInfoByGoodsId(Long goodsId) {
        this.baseMapper.deleteProductBaseInfoByGoodsId(goodsId);
    }

    @Override
    public void solveEditCraft(Long goodsId,String craftOptionIds) {
        this.baseMapper.solveEditCraft(goodsId,craftOptionIds);
    }

    @Override
    public List<Integer> selectTwbOptionIds(Long goodsId) {
        return this.baseMapper.selectTwbOptionIds(goodsId);
    }

}
